package com.agg.core.base;

import com.agg.core.base.dto.BaseDTO;
import com.agg.core.base.po.BasePO;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.io.Serializable;
import java.util.List;
import java.util.Map;


public class Parameter implements Serializable {
    private String service;
    private String method;
    private Object[] param;
    private Long id;
    private BaseDTO model;
    private Map<?, ?> map;
    private Page<?> page;
    private List<?> list;
    private Object result;
    private BaseDTO dto;

    private final String no = "[" + IdWorker.getId() + "]";

    public Parameter(String service, String method) {
        this.service = service;
        this.method = method;
    }

    public Parameter(Object result) {
        if ((result instanceof Long)) {
            this.id = ((Long) result);
        } else if ((result instanceof BasePO)) {
            this.model = ((BaseDTO) result);
        } else if ((result instanceof BaseDTO)) {
            this.dto = ((BaseDTO) result);
        } else if ((result instanceof Page)) {
            this.page = ((Page) result);
        } else if ((result instanceof Map)) {
            this.map = ((Map) result);
        } else if ((result instanceof List)) {
            this.list = ((List) result);
        } else if ((result instanceof Object[])) {
            this.param = ((Object[]) result);
        } else {
            this.result = result;
        }
    }


    public Parameter() {
    }
}
